package com.ms.p2p.provider;

import com.ms.common.exception.NoticeException;
import com.ms.p2p.bean.PageBean;
import com.ms.p2p.entity.loan.Loan;
import com.ms.p2p.entity.loan.LoanTenderRecord;
import com.ms.p2p.entity.member.Member;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 *
 */

public interface LoanTenderRecordProvider {
	

	public List getList(int loanId) ;

	public double getUserTenderSum(int loanId, int userId);
	/**
	 * 插入投标记录，增加user表的投标次数，记录初次投标时间
	 * 
	 * @param map
	 * @param max_account
	 * @param user
	 * @return
	 */

	public int addTenderLog(LoanTenderRecord map, BigDecimal max_account, Member user);

	/**
	 * 投标时间查出一个标下的所有投标记录（投标时间倒序）
	 * 
	 * @param loanId
	 * @return
	 */
	public List<LoanTenderRecord> getTenderLog(int loanId);


	public List<Map<String,Object>> findTenders(int loanId);



	public Map<String, Object> sumByBorrowId(int borrowId);


	public List<Map<String,Object>> findPager(Integer id,String status, PageBean page) ;


	public int findCount(Integer id,String status);


	public List<Map<String,Object>> findLoanPager(Integer id,String status, PageBean page) ;


	public int findLoanCount(Integer id,String status);

	/**
	 * 根据ID查询一条投标记录
	 */
	public LoanTenderRecord findById(int id);


	public int update(LoanTenderRecord loanTenderRecord);

	/**
	 *  累计赚取收益
	 * @return
	 */
	public Map<String, Object> countTotalIncome();


	public String countWailtAccount();

	/**
	 * 新手标判断
	 * */
	public void doRookie(Member user, Loan borrow) throws NoticeException;

	List<Map<String, Object>> findActive();
}
